<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>
  <div id="app">
    <gp-18 :mytitle="title" :userlist="list"></gp-18>
  </div>

  <script type="text/template" id="gp18Temp">
    <div>
    <h1>{{mytitle}}</h1>
    <ul>
      <li v-for="user in userlist">
        {{user.username}}-{{user.age}}
      </li>
    </ul>
  </div>
  </script>

  <script>
    // 全局组件
    Vue.component('gp-18', {
      props: ['mytitle', "userlist"],
      template: "#gp18Temp",
      methods: {
      }
    })

    var vm = new Vue({
      el: "#app",
      data: {
        title: "from to root title",
        list: [
          { username: 'hanye', age: 20 },
          { username: 'hansai', age: 21 }
        ]
      },

    })
  </script>

</body>

</html>